<template>
	<view class="main">
		<view class="list" v-for="item in list" @click="detail">
			<view class="amount">
				提现金额：￥{{item.money}}
			</view>
			<view class="time">
				{{item.createtime | time}}
			</view>
			<view class="status">
				提现成功
			</view>
			<view class="look">
				查看详情
			</view>
		</view>
		<u-empty v-if="list.length==0" text="暂无数据" mode="list"></u-empty>
	</view>
</template>

<script>
	import {withdrawalRecord} from "@/api/index.js"
	export default {
		data() {
			return {
				finish: false,
				list:[],
				page: 1,
				size: 10,
			};
		},
		filters: {
			time(time) {
				let date = new Date(time);
				let year = date.getFullYear();
				let month = ('0' + (date.getMonth() + 1)).slice(-2); // 月份从0开始，需要加1，并且补零
				let day = ('0' + date.getDate()).slice(-2);
				let hours = ('0' + date.getHours()).slice(-2);
				let minutes = ('0' + date.getMinutes()).slice(-2);
				let seconds = ('0' + date.getSeconds()).slice(-2);
		
				// 拼接成最终的时间字符串
				return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
			}
		},
		methods: {
			//获取收益明细
			getDetail(){
				let params = {
					page:this.page,
					page_size:10,
				}
				withdrawalRecord(params).then(res=>{
					if(res.data == 1){
						this.list = this.list.concat(res.data.list)
						uni.stopPullDownRefresh();
					}
				})
			},
			enablePullDownRefresh() {
				this.page++
				this.getMyCustomer()
			},
			detail() {
				uni.navigateTo({
					url: "/pages/wallet/withdrawalDetail"
				})
			},
			//下拉刷新
			onPullDownRefresh() {

			},
			//上拉加载更多
			onReachBottom() {
				if (!this.finish) {

				}
			},
		}
	}
</script>

<style lang="scss">
	.main {
		background-color: #fff;
	}

	.list {
		display: flex;
		align-items: center;
		font-size: 26rpx;
		padding: 26rpx;
		border-bottom: 1px solid #f2f2f2;

		.amount {
			width: 250rpx;
		}

		.time {
			width: 180rpx;
		}

		.status {
			width: 120rpx;
			color: #d4237a;
		}

		.look {
			flex: 1;
			border: 1px solid #3B81F3;
			text-align: center;
			padding: 6rpx 0;
			border-radius: 10rpx;
			color: #3B81F3;
		}
	}
</style>